import { randomUUID } from "../createUUID";
import { user } from "../local";

export class ProPixelUser {
    avatar: string = "";
    userName: string = "基础用户";
    userID: string = randomUUID();
    /** 文件的列表，保存了相应的 preview 的 key 值 */
    fileList: string[] = [];
    constructor(User: ProPixelUser | null) {
        if (User) {
            Object.assign(this, User);
        } else {
            this.save();
        }
    }
    /** 保存用户数据 */
    async save() {
        const data = JSON.parse(JSON.stringify(this));
        console.log(data);
        await user.setItem("userMessage", data);
    }
}
